package com.xmut.base.service;

import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;

import java.io.Serializable;
import java.util.List;

public interface BaseService<T, ID extends Serializable>{
    JpaRepository<T, ID> getDao();

    List<T> findAll();

    List<T> findAll(Sort var1);

    Page<T> findAll(Pageable pageable);

    List<T> findAll(Iterable<ID> var1) ;

    long count() ;

    void delete(ID id) ;

    void delete(T t) ;

    void delete(Iterable<? extends T> iterable) ;

    void deleteAll() ;

    <S extends T> S save(S s) ;

    <S extends T> List<S> save(Iterable<S> var1) ;

    T findOne(ID id) ;

    boolean exists(ID id) ;

    void flush() ;

    <S extends T> S saveAndFlush(S var1) ;

    void deleteInBatch(Iterable<T> var1) ;

    void deleteAllInBatch() ;

    T getOne(ID var1) ;

    <S extends T> S findOne(Example<S> example);

    <S extends T> List<S> findAll(Example<S> var1);

    <S extends T> List<S> findAll(Example<S> var1, Sort var2);

    <S extends T> Page<S> findAll(Example<S> example, Pageable pageable);

    <S extends T> long count(Example<S> example);

    <S extends T> boolean exists(Example<S> example);
}
